Micron Document
`:top
`!Python Imaging Library`! is a `F33f`_`[free and open-source`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Free_and_open-source_software]`_`f additional `F33f`_`[library`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Library_(computing)]`_`f for the `F33f`_`[Python programming language`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Python_(programming_language)]`_`f that adds support for opening, `F33f`_`[manipulating`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Image_editing]`_`f, and saving many different `F33f`_`[image file formats`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Image_file_formats]`_`f. It is available for `F33f`_`[Windows`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft_Windows]`_`f, Mac OS X and `F33f`_`[Linux`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Linux]`_`f. The latest version of PIL is 1.1.7, was released in September 2009 and supports Python 1.5.2–2.7.`:cite-ref-website-3-1[`F5bf`_`[3`#cite-note-website-3]`_`f]

Development of the original project, known as `!PIL`!, was discontinued in 2011.`:cite-ref-hg-2-1[`F5bf`_`[2`#cite-note-hg-2]`_`f] Subsequently, a successor project named `!Pillow`! `F33f`_`[forked`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Fork_(software_development)]`_`f the PIL repository and added Python 3.x support.`:cite-ref-pillow-5-0[`F5bf`_`[5`#cite-note-pillow-5]`_`f] This fork has been adopted as a replacement for the original PIL in `F33f`_`[Linux distributions`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Linux_distribution]`_`f including `F33f`_`[Debian`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Debian_GNU/Linux]`_`f`:cite-ref-6[`F5bf`_`[6`#cite-note-6]`_`f] and `F33f`_`[Ubuntu`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Ubuntu]`_`f (since `F33f`_`[13.04`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Ubuntu_version_history]`_`f).`:cite-ref-7[`F5bf`_`[7`#cite-note-7]`_`f]

>>Contents

• `F0af`_`[Capabilities`#capabilities]`_`f
• `F0af`_`[File formats`#file-formats]`_`f
• `F0af`_`[Programming examples`#programming-examples]`_`f
• `F0af`_`[References`#references]`_`f
• `F0af`_`[External links`#external-links]`_`f

-─

>>Capabilities

PIL offers several standard procedures for image manipulation. These include:

• per-pixel manipulations,`:cite-ref-8[`F5bf`_`[8`#cite-note-8]`_`f]
• masking and transparency handling,
• image filtering, such as blurring, contouring, smoothing, or edge finding,`:cite-ref-9[`F5bf`_`[9`#cite-note-9]`_`f]
• image enhancing, such as sharpening, adjusting brightness, contrast or color,`:cite-ref-10[`F5bf`_`[10`#cite-note-10]`_`f]
• adding text

>>File formats

Supported file formats include `F33f`_`[PPM`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Netpbm_format]`_`f, `F33f`_`[PNG`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Portable_Network_Graphics]`_`f, `F33f`_`[JPEG`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=JPEG]`_`f, `F33f`_`[GIF`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=GIF]`_`f, `F33f`_`[TIFF`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=TIFF]`_`f, and `F33f`_`[BMP`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=BMP_file_format]`_`f. PIL is extensible, allowing users to create custom decoders for any file format.`:cite-ref-11[`F5bf`_`[11`#cite-note-11]`_`f]

>>Programming examples

`B100`F9d9import os`f`b
`B100`F9d9from PIL import Image`f`b
`B100`F9d9`f`b
`B100`F9d9`f`b
`B100`F9d9def convert_jpegs_to_pngs(folder_path):`f`b
`B100`F9d9 # Checks if the provided path is a folder`f`b
`B100`F9d9 if not os.path.isdir(folder_path):`f`b
`B100`F9d9 print(f"Error: {folder_path} is not a valid folder.")`f`b
`B100`F9d9 return`f`b
`B100`F9d9`f`b
`B100`F9d9 # Iterates over all files in the folder`f`b
`B100`F9d9 for filename in os.listdir(folder_path):`f`b
`B100`F9d9 # Checks if the file has a .jpg or .jpeg extension`f`b
`B100`F9d9 if filename.lower().endswith(".jpg") or filename.lower().endswith(".jpeg"):`f`b
`B100`F9d9 # Full path of the file`f`b
`B100`F9d9 jpeg_path = os.path.join(folder_path, filename)`f`b
`B100`F9d9 # Path for the converted file`f`b
`B100`F9d9 png_path = os.path.join(folder_path, os.path.splitext(filename)[0] + ".png")`f`b
`B100`F9d9`f`b
`B100`F9d9 try:`f`b
`B100`F9d9 # Opens the JPEG image`f`b
`B100`F9d9 with Image.open(jpeg_path) as img:`f`b
`B100`F9d9 # Converts and saves as PNG`f`b
`B100`F9d9 img.save(png_path, "PNG")`f`b
`B100`F9d9 print(f"Converted {jpeg_path} to {png_path}")`f`b
`B100`F9d9 except Exception as e:`f`b
`B100`F9d9 print(f"Error converting {jpeg_path}: {e}")`f`b

>>References

`:cite-note-license-1`!1.`! "Software License". `*Secret Labs AB`*. Archived from the original on 20 July 2020. Retrieved December 8, 2013.
`:cite-note-hg-2`!2.`! "effbot / pil-2009-raclette". Archived from the original on 15 March 2015. Retrieved December 8, 2013.
`:cite-note-website-3`!3.`! "Python Imaging Library". `*Secret Labs AB`*. Archived from the original on 21 November 2020. Retrieved December 8, 2013.
`:cite-note-4`!2.`! "Release Notes". `*Pillow (PIL Fork) Documentation`*. Retrieved February 5, 2025.
`:cite-note-pillow-5`!5.`! `F0af`_`[↑`#cite-ref-pillow-5-0]`_`f "Pillow: a modern fork of PIL". Retrieved December 8, 2013.
`:cite-note-6`!6.`! `F0af`_`[↑`#cite-ref-6]`_`f "Details of package python-imaging in sid". `*packages.debian.org`*. `F33f`_`[Software in the Public Interest`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Software_in_the_Public_Interest]`_`f. Retrieved December 8, 2013.
`:cite-note-7`!7.`! `F0af`_`[↑`#cite-ref-7]`_`f "Details of package python-imaging in raring". `*ubuntu.com`*. `F33f`_`[Canonical Ltd.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Canonical_Ltd.]`_`f Retrieved December 8, 2013.
`:cite-note-8`!8.`! `F0af`_`[↑`#cite-ref-8]`_`f "PyAccess Module". `*readthedocs.io`*. Retrieved September 20, 2024.
`:cite-note-9`!9.`! `F0af`_`[↑`#cite-ref-9]`_`f "ImageFilter Module". `*readthedocs.io`*. Retrieved September 20, 2024.
`:cite-note-10`!10.`! `F0af`_`[↑`#cite-ref-10]`_`f "ImageColor Module". `*readthedocs.io`*. Retrieved September 20, 2024.
`:cite-note-11`!11.`! `F0af`_`[↑`#cite-ref-11]`_`f "D. Writing Your Own File Decoder". Effbot.org. Retrieved 2014-01-28.

>>External links

• Official website
• PIL Library reference
• Python Imaging Library at Wikibooks
• Pillow (Successor project)
• PIL Tutorial Examples

`c`F0af`_`[↑ Back to top`#top]`_`f`a